import React, {Component} from "react";
import {Text, View, ListView} from "react-native";
import {styles} from "./MyStyle";
export default class ListViewBasics extends Component {
  // 初始化模拟数据
  constructor(props) {
    super(props);
    const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
    this.state = {
      dataSource: ds.cloneWithRows([
        'John', 'Joel', 'James', 'Jimmy', 'Jackson', 'Jillian', 'Julie', 'Devin'
      ])
    };
  }

  render() {
    return (
      <View style={{flex: 1, paddingTop: 22,paddingLeft:12,paddingRight:12}}>
        <ListView
          //列表的数据源
          dataSource={this.state.dataSource}
          //解析数据源中的数据
          renderRow={(rowData) => <Text style={styles.welcome}>{rowData}</Text>}
        />
      </View>
    );
  }
}